package com.lemon.boot.common.properties;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author 李猛
 * @datetime 2024/8/1 15:53
 * @description TODO
 */
@Setter
@Getter
@Component
@ConfigurationProperties(prefix = "remember-me")
public class RememberMeConfigProperties {
    //是否使用安全cookie
    private boolean useSecureCookie;
    //过期时间-单位天
    private int tokenValidityDays;
    //登录参数
    private String loginParameter;
    //记住我参数
    private String rememberMeParameter;
    //开启总是记住我
    private boolean alwaysRemember;
    //记住我cookie名称
    private String rememberMeCookieName;

    /**
     * 过期时间-单位秒
     *
     * @return
     */
    public int getTokenValiditySeconds() {
        return tokenValidityDays * 24 * 60 * 60;
    }
}
